package cn.kgc.ybis.controller;/*
package cn.kgc.ybis.controller;

import cn.kgc.ybis.pojo.Teacher;
import cn.kgc.ybis.service.TeacherService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;

@Controller
public class TestController {
    @Resource
    TeacherService teacherService;

    //分页查询
    @RequestMapping("/select")
    public String select(@RequestParam(value = "pageNum", defaultValue = "1", required = false) Integer pageNum,
                         @RequestParam(value = "pageSize", defaultValue = "5", required = false) Integer pageSize,
                         @RequestParam(value = "keyword", defaultValue = "", required = false) Integer keyword,
                         Model model) {
        PageInfo<Teacher> pageInfo = teacherService.select(pageNum, pageSize, keyword);
        model.addAttribute("pageNum", pageNum);
        model.addAttribute("keyword", keyword);
        model.addAttribute("pageInfo", pageInfo);
        return "teacher";
    }

    //添加
    @RequestMapping("/toadd")
    public String toadd() {
        return "add";
    }

    @RequestMapping("/add1")
    public String add(Teacher teacher, Model model) {
        teacherService.Add(teacher);
        return "redirect:/select";
    }

    //修改
    @RequestMapping("/toupdate")
    public String toupdate(Integer id, @RequestParam(value = "pageNum", defaultValue = "1", required = false) Integer pageNum,
                           @RequestParam(value = "pageSize", defaultValue = "5", required = false) Integer pageSize,
                           @RequestParam(value = "keyword", defaultValue = "", required = false) String keyword,
                           Model model) {
        Teacher teacher = teacherService.toupdate(id);
        model.addAttribute("teacher", teacher);
        model.addAttribute("pageSize", pageSize);
        model.addAttribute("keyword", keyword);
        model.addAttribute("pageNum", pageNum);
        return "update";
    }

    @RequestMapping("/update")
    public String update(Teacher teacher, @RequestParam(value = "pageNum", defaultValue = "1", required = false) Integer pageNum,
                         @RequestParam(value = "pageSize", defaultValue = "5", required = false) Integer pageSize,
                         @RequestParam(value = "keyword", defaultValue = "", required = false) String keyword,
                         Model model) {
        teacherService.update(teacher);
        return "redirect:/select";
    }
    //删除
    @RequestMapping("/delete")
    public String delete(Integer id){
        teacherService.delete(id);
        return "redirect:/select";
    }

}
*/
